﻿using System.Collections.Generic;

namespace Sai.Core
{
    public class AddedTypesListingFactory : ITypeListingFactory
    {
        private ApplicationVersionStamp avs = new ApplicationVersionStamp();

        public ITypeListing Create(IEnumerable<IAssemblyDifference> differences)
        {
            var listing = new TypeListingByNamespace
            {
                Name = "Added Types",
                ProductLink = this.avs.Link,
                ProductVersion = this.avs.Version
            };

            foreach (var diff in differences)
            {
                if (diff.AddedTypes != null)
                    listing.Add(diff.AddedTypes);
            }

            return listing;
        }
    }
}
